'''
Created on 22 Jul 2013

@author: Matt
'''
from MattCrypto.CryptoFunctions import hexStrToBits, xor

if __name__ == '__main__':
    hexOnesAndZeroes = "d6f491c5b645c008" 
    hexAllZeroes = "290b6e3a39155d6f"
     
    binOnesAndZeroes = hexStrToBits(hexOnesAndZeroes)
    binAllZeroes = hexStrToBits(hexAllZeroes)
     
    print(xor(binOnesAndZeroes, binAllZeroes))
     
    hexOnesAndZeroes = "87a40cfa8dd39154" 
    hexAllZeroes = "4af532671351e2e1"
     
    binOnesAndZeroes = hexStrToBits(hexOnesAndZeroes)
    binAllZeroes = hexStrToBits(hexAllZeroes)
     
    print(xor(binOnesAndZeroes, binAllZeroes))
     
    hexOnesAndZeroes = "bbe033c00bc9330e" 
    hexAllZeroes = "5f67abaf5210722b"
     
    binOnesAndZeroes = hexStrToBits(hexOnesAndZeroes)
    binAllZeroes = hexStrToBits(hexAllZeroes)
     
    print(xor(binOnesAndZeroes, binAllZeroes))
     
    hexOnesAndZeroes = "325032a9c5e2364b" 
    hexAllZeroes = "7c2822ebfdc48bfb"
     
    binOnesAndZeroes = hexStrToBits(hexOnesAndZeroes)
    binAllZeroes = hexStrToBits(hexAllZeroes)
     
    print(xor(binOnesAndZeroes, binAllZeroes))
    
    #plain1 = strToBits("attack at dawn")
    #print(plain1)
    #cipher1 = hexStrToBits("09e1c5f70a65ac519458e7e53f36")
    #print(cipher1)
    #keyBits = xor(plain1, cipher1)
    #print(keyBits)
    #plain2 = strToBits("attack at dusk")
    #print(plain2)
    #cipher2 = xor(plain2, keyBits)
    #print(cipher2)
    #hexBits = hex(int(("").join(map(str, cipher2)), 2))
    #print(hexBits)